package cli

import (
	"flag"
	"fmt"
	"github.com/spf13/viper"
	"tg-bot/common"
)

var (
	logDir   = flag.String("log-dir", "", "specify the log directory")
	Config   = flag.String("config", "config.yml", "specify the config.yml path")
	showHelp = flag.Bool("help", false, "show this help message and exit")
	showVer  = flag.Bool("version", false, "show version and exit")
)

func FlagConfig() {
	flag.Parse()

	if *logDir != "" {
		viper.Set("log_dir", *logDir)
	}

}

func help() {
	fmt.Println("TG-BOT " + common.VESRION + " - All in one API service for TG-BOT.")
	fmt.Println("Copyright (C) 2024 MartialBE. All rights reserved.")
	fmt.Println("Original copyright holder: JustSong")
	fmt.Println("GitHub: https://github.com/MartialBE/one-api")
	fmt.Println("Usage: one-api [--port <port>] [--log-dir <log directory>] [--config <config.yaml path>] [--version] [--help]")
}
